package com.drawu.drawuspring.service.impl;

import com.drawu.drawuspring.domain.po.GameComments;
import com.drawu.drawuspring.mapper.GameCommentsMapper;
import com.drawu.drawuspring.service.IGameCommentsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hui
 * @since 2024-11-26
 */
@Service
public class GameCommentsServiceImpl extends ServiceImpl<GameCommentsMapper, GameComments> implements IGameCommentsService {

    /**
     * 根据游戏id查询评论列表
     *
     */
    @Override
    public List<GameComments> listByGameIds(Set<Integer> gameIds) {
        if (gameIds == null || gameIds.isEmpty()) {
            throw new IllegalArgumentException("gameIds cannot be null or empty");
        }
        return lambdaQuery().in(GameComments::getGameId, gameIds).list();
    }

    /**
     * 根据游戏id查询评论列表
     *
     */
    @Override
    public List<GameComments> listByGameId(Integer id) {
        return lambdaQuery().eq(GameComments::getGameId, id).list();
    }
}
